﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;
using DAL;
namespace Entities
{

    [TableName("ChiTietKeHoachGiangDay")]
    public class ChiTietKeHoachGiangDay : BaseEntity<ChiTietKeHoachGiangDay>
    {
        [MapField("MaKH"), PrimaryKey]
        public string MaKH { get; set; }
        [MapField("MaLop")]
        public string MaLop { get; set; }
        [MapField("GhepLop")]
        public string GhepLop { get; set; }
        [MapField("MaMH")]
        public string MaMH { get; set; }
        [MapField("MaGV")]
        public string MaGV { get; set; }
        [MapField("SoTietLTDaDay")]
        public int SoTietLTDaDay { get; set; }
        [MapField("SoTietTHDaDay")]
        public int SoTietTHDaDay { get; set; }
        [MapField("SoTietLTConLai")]
        public int SoTietLTConLai { get; set; }
        [MapField("SoTietTHConLai")]
        public int SoTietTHConLai { get; set; }
        [MapField("SoTuanConLai")]
        public int SoTuanConLai { get; set; }
        [MapField("MaQL")]
        public string MaQL { get; set; }

        [MapIgnore]
        public string TenMH
        {
            get 
            {
                MonHoc mh = MonHoc.Objects.GetById(MaMH);
                if (mh != null)
                    return mh.TenMH;
                return "";
            }
        }
        [MapIgnore]
        public int STC
        {
            get
            {
                MonHoc mh = MonHoc.Objects.GetById(MaMH);
                if (mh != null)
                    return mh.STC;
                return 0;
            }
        }
        [MapIgnore]
        public int SoTCLT
        {
            get
            {
                MonHoc mh = MonHoc.Objects.GetById(MaMH);
                if (mh != null)
                    return mh.SoTCLT;
                return 0;
            }
        }
        [MapIgnore]
        public int SoTCTH
        {
            get
            {
                MonHoc mh = MonHoc.Objects.GetById(MaMH);
                if (mh != null)
                    return mh.SoTCTH;
                return 0;
            }
        }
        [MapIgnore]
        public string TenGV
        {
            get
            {
                GiaoVien gv = GiaoVien.Objects.GetById(MaGV);
                
                
                if (gv != null)
                    return gv.HoTen;
                return "";
            }
        }
        
    }
}
